package contest1608;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class H {
    static Scanner cin = new Scanner(new BufferedInputStream(System.in));//大量输入优化版本
    static PrintWriter cout = new PrintWriter(new BufferedOutputStream(System.out));//大量输出优化版本
    static PrintWriter cerr = new PrintWriter(System.err, true);//开启调试模式,一般输出量不大，不需要buffered

    static int selectSort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int k = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[k]) {
                    k = j;
                }
            }
            if (k != i) {
                int t = a[i];
                a[i] = a[k];
                a[k] = t;
                ++cnt;
            }

        }
        return cnt;
    }

    public static void main(String[] args) {
        //TODO AOJ开启你的ACM传奇人生
        cerr.println("-----Start your ACM legendary life with AOJ(www.webturing.com)----");
        int n = cin.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = cin.nextInt();
        }
        int cnt = selectSort(a);
        for (int each : a) {
            cout.print(each + " ");
        }
        cout.println("\n" + cnt);
        cin.close();//关闭输入流
        cout.close();//关闭输出流，这是必须的，否则一般不会自动刷新缓冲区
    }
}

